package com.dd.stack.se.stream.simple.datasource;

import com.dd.stack.se.stream.simple.pijo.StudentBO;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Author liuxianmeng
 * @CreateTime 2024/11/15 0:05
 * @Description 自定义数据
 */
public class CustomData {
    public static List<StudentBO> studentBOS;
    static {
        studentBOS = new ArrayList<>();

        for (int i = 1; i <= 30; i++) {
            Map<String, Integer> courseGrades = new HashMap<>();
            courseGrades.put("Math", (int) (Math.random() * 100));
            courseGrades.put("Science", (int) (Math.random() * 100));

            List<String> hobbies = new ArrayList<>();
            hobbies.add("Hobby " + i);

            Map<String, Double> distancesToPointsOfInterest = new HashMap<>();
            distancesToPointsOfInterest.put("School", Math.random() * 10);
            distancesToPointsOfInterest.put("Library", Math.random() * 10);

            List<String> nearbyPlaces = new ArrayList<>();
            nearbyPlaces.add("Place " + i);

            StudentBO studentBO = new StudentBO(
                    "StudentBO " + i,
                    (int) (Math.random() * 20) + 10,
                    Math.random() * 100,
                    (long) i,
                    hobbies,
                    courseGrades,
                    new StudentBO.Address(
                            "Street " + i,
                            "City " + i,
                            (int) (Math.random() * 50),
                            (long) (Math.random() * 100000),
                            nearbyPlaces,
                            distancesToPointsOfInterest
                    ),
                    Math.random() > 0.5,
                    (int) (Math.random() * 10),
                    Math.random() * 4
            );
            studentBOS.add(studentBO);
        }
    }
}
